<!--
 * @Author: canlong.shen
 * @Date: 2021-10-21 16:57:26
 * @LastEditors: your name
 * @LastEditTime: 2021-10-25 16:46:21
 * @Description: file content
-->
<html>
  <head>
    <title>课02.怎样快速安装和使用Vuex</title>
    <!-- vue -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <!-- vuex -->
    <script src="https://unpkg.com/vuex@3.6.2/dist/vuex.js"></script>
  </head>
  <body>
    
    <script>
       
     const store = new Vuex.Store(
             {
                 state:{
                    count:0
                 },
                 mutations:{
                     increment(state){
                         state.count ++
                     }
                 }
             }
         )

        console.log("before",store.state.count)
        store.commit('increment')
        console.log("after",store.state.count)

    </script>

  </body>
</html>
